package com.sh1604.duitang.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;

import com.sh1604.duitang.R;
import com.sh1604.duitang.mybean.ImageBean;
import com.squareup.picasso.Picasso;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;

/**
 * ***********************************************************
 * author: jie
 * time: 2016/7/20 17:37
 * name:
 * overview:Build.VERSION.SDK_INT:版本号
 * usage:
 * *************************************************************
 */
public class FindPagerAdapter extends BaseAdapter {
    private Context mContext;
    private ArrayList<ImageBean.DataBean.GroupItemsBean> mDatas;

    public FindPagerAdapter(Context context, ArrayList<ImageBean.DataBean.GroupItemsBean> datas) {
        this.mContext = context;
        this.mDatas = datas;
    }

    @Override
    public int getCount() {
        return mDatas == null ? 0 : mDatas.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewerHolder holder = null;
        if (convertView==null){
            holder = new ViewerHolder();
            convertView = LayoutInflater.from(mContext).inflate(R.layout.item_find_a,parent,false);
            holder.item_gv = (GridView) convertView.findViewById(R.id.gv);
            convertView.setTag(holder);
        }else {
            holder = (ViewerHolder) convertView.getTag();
        }
        if (holder.item_gv!=null){
            mDatas = this.mDatas;
            GvAdapter gvAdapter = new GvAdapter(mContext, (List<ImageBean.DataBean.GroupItemsBean>) mDatas);
            holder.item_gv.setAdapter(gvAdapter);
        }
        return convertView;
    }

    private class ViewerHolder {
        private GridView item_gv;
    }
}
